
template <class T>
BoundingBox<T>::BoundingBox()
{
    Center = Vector2<T>(0, 0);
    Extents = Vector2<T>(0, 0);
}


template <class T>
BoundingBox<T>::BoundingBox(const Vector2<T>& center, const Vector2<T>& extents)
{
    Center = center;
	Extents = extents;
}


template <class T>
Vector2<T> BoundingBox<T>::GetMin() const
{
	return Center - Extents;
}

template <class T>
Vector2<T> BoundingBox<T>::GetMax() const
{

	return Center + Extents;

}

template <class T>
bool BoundingBox<T>::Contains(const Vector2<T>& point) const
{

	return Contains(point.x, point.y);

}

template <class T>
bool BoundingBox<T>::Contains(T x, T y) const
{

	Vector2<T> min = GetMin();
	Vector2<T> max = GetMax();

	if ((x >= min.x) && (x <= max.x) && (y >= min.y) && (y <= max.y))
		return true;

	return false;

}

template <class T>
BoundingBox<T> BoundingBox<T>::Expand(T x, T y) const
{

	return BoundingBox(Center, Vector2<T>(Extents.x + x, Extents.y + y));

}

template <class T>
T BoundingBox<T>::GetWidth() const
{

	return Extents.x * 2;

}

template <class T>
T BoundingBox<T>::GetHeight() const
{

	return Extents.y * 2;

}
